<?php

class Login_model extends CI_Model{
	
	//Register a new user in the database
	function registerUser($openid_url, $username, $email){
		//TODO register a user in the database
		$data = array('openidURL'=>$openid_url, 'username'=>$username, 'email'=>$email);
		$this->db->insert('user_openids', $data);
	}
	
	//Checks if a openid_url is registered in the database.
	function isRegistered($openid_url){
		$this->db->where('openidURL', $openid_url);
		$query = $this->db->get('user_openids');
		
		if($query->num_rows() == 1){
			return TRUE; //User is registered
		}
		
		return FALSE;
	}
	
}
